package ict.kth.se.model.repository;

import ict.kth.se.exceptions.EntityAlreadyExistsInDBException;
import ict.kth.se.exceptions.EntityDoesntExistInDBException;
import ict.kth.se.model.Competence;
import ict.kth.se.model.CompetenceProfile;

import java.sql.SQLException;
import java.util.List;

public interface CompetenceProfileRepository {

	/**
	 * Get CompetenceProfile by id
	 * @param id Id of competenceProfile
	 * @return Found competenceProfile
	 */
	public CompetenceProfile getCompetenceProfileById(Long id) throws SQLException;
	
	/**
	 * Get CompetenceProfiles by person's id
	 * @param id Id of person to get competenceProfile
	 * @return Found competenceProfiles
	 */
	public List<CompetenceProfile> getCompetenceProfilesByPersonId(Long personId) throws SQLException;
	
	/**
	 * Get all competence profiles
	 * @return Found competence profiles
	 */
	public List<CompetenceProfile> getAllCompetenceProfiles() throws SQLException;
	
	/**
	 * This method removes one competenceProfile from database (by it's ID)
	 * @param competenceProfile The competenceProfile to be removed
	 * @throws EntityDoesntExistInDBException If competenceProfile doesn't exist in database
	 * @throws SQLException
	 */
	public void removeCompetenceProfile(CompetenceProfile competenceProfile) throws EntityDoesntExistInDBException, SQLException;
	
	/**
	 * This method removes one competenceProfile from database by person's ID
	 * @param personId ID of the person to delete competenceProfiles for
	 * @throws EntityDoesntExistInDBException If competenceProfile doesn't exist in database
	 * @throws SQLException
	 */
	public void removeCompetenceProfilesForPerson(Long personID) throws EntityDoesntExistInDBException, SQLException;
	
	/**
	 * This method adds an competenceProfile in DB
	 * @param competenceProfile CompetenceProfile to be added
	 * @param personId Id of person that competenceProfile should be connected to
	 * @return Newly created competenceProfile
	 * @throws EntityAlreadyExistsInDBException If such competenceProfile already exists in DB (by name)
	 * @throws SQLException
	 */
	public CompetenceProfile createCompetenceProfile(CompetenceProfile competenceProfile, Long personId) throws EntityAlreadyExistsInDBException, SQLException;
	
	/**
	 * This method updates an competenceProfile in DB
	 * @param competenceProfile CompetenceProfile to be updated
	 * @param personId Id of person that competenceProfile should be connected to
	 * @throws EntityDoesntExistInDBException If such competenceProfile doesn't exist in DB (by id)
	 * @throws SQLException
	 */
	public void updateCompetenceProfile(CompetenceProfile competenceProfile, Long personId) throws EntityDoesntExistInDBException, SQLException;
}
